package com.wisdom.view;

import org.sipdroid.sipua.R;

import android.app.Activity;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;

public class DialSettingActivity extends Activity {
	RadioButton callbackRadio;
	RadioButton directcallRadio;
	RadioButton wisdomCallRadio;
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_dialsetting);
		initResourceRefs();
		
	    //根据ID找到RadioGroup实例
		         RadioGroup group = (RadioGroup)this.findViewById(R.id.radioGroupcallsetting);
		         //绑定一个匿名监听器
		         group.setOnCheckedChangeListener(new OnCheckedChangeListener() {
		             
		             @Override
		             public void onCheckedChanged(RadioGroup arg0, int arg1) {
		                 // TODO Auto-generated method stub
		                //获取变更后的选中项的ID
		                int radioButtonId = arg0.getCheckedRadioButtonId();
		                 //根据ID获取RadioButton的实例
		                RadioButton rb = (RadioButton)DialSettingActivity.this.findViewById(radioButtonId);
		                 //更新文本内容，以符合选中项
		                String callsetting="";
		                if(rb.getText().equals("回拨方式"))
		                	callsetting="1";
		                if(rb.getText().equals("直拨方式"))
		                	callsetting="2";
		                if(rb.getText().equals("智能直拨方式"))
		                	callsetting="3";
		               // CCPConfig.CallSetting=callsetting;
		               // CCPConfig.setConfigProperties("callsetting",callsetting);
		            }
		         });
	}
	void initResourceRefs(){
		callbackRadio=(RadioButton)this.findViewById(R.id.radio0);
		directcallRadio=(RadioButton)this.findViewById(R.id.radio1);
		wisdomCallRadio=(RadioButton)this.findViewById(R.id.radio2);
		/*if(CCPConfig.CallSetting.equals("1"))
			callbackRadio.setChecked(true);
		if(CCPConfig.CallSetting.equals("2"))
			directcallRadio.setChecked(true);
		if(CCPConfig.CallSetting.equals("3"))
			wisdomCallRadio.setChecked(true);*/
	}
}
